﻿<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="NewReviewFileComment.aspx.cs" Inherits="CodeDemon.Views.Review.NewReviewFileComment" %>

<%
    var reviewer = (from partlist in ViewData.Model.DAO.GetReviewParticipantsByReviewID(ViewData.Model.CurrentReviewID) where partlist.ParticipantIsReviewer == true && partlist.ReviewUserID == ViewData.Model.CurrentReviewUserID select partlist).Count();

 %>

<h3>Add Review File Comments</h3>

<form action="/CodeDemon/Review/InsertReviewFileComment" method="post" id="htmlForm<%=ViewData.Model.CurrentReviewFileID %><%=ViewData.Model.CurrentLineNumber %>">

<p>
    <textarea name="commentText" rows="10" cols="50"></textarea>
</p>

<%var sevs = from sevlist in ViewData.Model.DAO.Severity select sevlist; %>
<div>
    <label for="severityID">Severity:</label>
    <select name="severityID">
        <%foreach (var sev in sevs ) { %>
            <option value="<%= sev.SeverityID %>"><%= sev.SeverityName %></option>
        
        <%} %>
    
    </select>
</div>


<div><label for"priority">Priority: <select name="priority">
    <option value="1">P1 - Lowest</option>
    <option value="2">P2</option>
    <option value="3" selected="selected">P3</option>
    <option value="4">P4</option>
    <option value="5">P5 - Highest</option>
    
</select></label></div>

<% if(reviewer > 0 ) { %>


<div><label for="change_status">Change Review Status:</label><input id="change_status" name="change_status" value="yes" type="checkbox" /></div>
<div id="status_change_menu" style="display:none;">
     <%
        var sl = from statusList in ViewData.Model.DAO.ReviewStatus where statusList.IsParticipantStatus == true select statusList;
        
         %>
         
         <% foreach (var s in sl) { %>
            <div><label for="newStatusId"><input type="radio" name="newStatusId" value="<%= s.ReviewStatusID %>" />Set Status To <%=s.StatusName %></label></div>
         <% } %>
</div>

<% } %>


<p>
<input value="Add Comment " name="SubmitNow" id="SubmitNow" type="submit" />
<input value="Cancel" name="Cancel" type="button" class="jqmClose" />

<%= Html.Hidden("ReviewFileId", ViewData.Model.CurrentReviewFileID.ToString())%>
<%= Html.Hidden("lineNumber", ViewData.Model.CurrentLineNumber.ToString())%>
</p>

<div id="results<%=ViewData.Model.CurrentReviewFileID %><%=ViewData.Model.CurrentLineNumber %>">
    Review File Comment Added.  <a href="#" class="jqmClose">Close Window</a>
</div>



<script type="text/javascript">
// prepare the form when the DOM is ready 
$(document).ready(function() { 
    $('#status_change_menu').hide(); 
    $('#change_status').click(function() {
        $('#status_change_menu').toggle('1'); 
    });
    $('#results<%=ViewData.Model.CurrentReviewFileID %><%=ViewData.Model.CurrentLineNumber %>').hide();
    // bind form using ajaxForm 
    $('#htmlForm<%=ViewData.Model.CurrentReviewFileID %><%=ViewData.Model.CurrentLineNumber %>').ajaxForm({ 
        // target identifies the element(s) to update with the server response 
        target: '#results<%=ViewData.Model.CurrentReviewFileID %><%=ViewData.Model.CurrentLineNumber %>', 
 
        // success identifies the function to invoke when the server response 
        // has been received; here we apply a fade-in effect to the new content 
        success: function() { 
            $('#results').show('1'); 
        <% if (ViewData.Model.CurrentLineNumber > 0) {  %>
            getReviewFileLineComments('<%=ViewData.Model.CurrentReviewFileID %>','<%=ViewData.Model.CurrentLineNumber %>');
            $('#ex<%=ViewData.Model.CurrentReviewFileID %>_<%=ViewData.Model.CurrentLineNumber %>').jqmHide();
        <% } else { %>
            getReviewFileComments('<%=ViewData.Model.CurrentReviewFileID %>');
            $('#ex<%=ViewData.Model.CurrentReviewFileID %>').jqmHide();
        <%} %>
        } 
    }); 
});
</script>

</form>